package org.example.Server.controller.unit;

import lombok.extern.slf4j.Slf4j;
import org.example.Server.service.unit.UnitService;
import org.example.Server.utils.ResultAPI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/youxich/unit")
public class UnitController {
    @Autowired
    UnitService unitService;

    /**
     * 课程章节-获取章节列表
     *
     * @param sem_id
     * @return
     */
    @GetMapping
    public ResultAPI getUnits(@RequestParam Integer sem_id) {
        return unitService.getUnits(sem_id);
    }

    /**
     * 获取课程单元下的资源
     *
     * @param unit_id
     * @return
     */
    @GetMapping("/{unit_id}")
    public ResultAPI getUnitResource(@PathVariable Integer unit_id) {
        return unitService.getUnitResource(unit_id);
    }
}
